package com.xzs.controller;

import com.xzs.annaotation.XzsAutowired;
import com.xzs.annaotation.XzsController;
import com.xzs.annaotation.XzsRequestMapping;

import com.xzs.annaotation.XzsRequestParam;
import com.xzs.service.LYTService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Created by zs.xu on 2020/8/13.
 */
@XzsController
@XzsRequestMapping("/xzs")
public class LYTController {
    @XzsAutowired("LYTService")
    private LYTService lytService;


    @XzsRequestMapping("/select")
    public void select(HttpServletRequest request, HttpServletResponse response,@XzsRequestParam("name") String name,@XzsRequestParam("value") String value){

        try {
            long startTime=System.currentTimeMillis();
            //执行方法
            PrintWriter pw = response.getWriter();
            String select = lytService.select(name, value);
            pw.write(select);
            long endTime=System.currentTimeMillis();
            float excTime=(float)(endTime-startTime)/1000;
            System.out.println("总方法 执行时间："+excTime+"s");

        } catch (IOException e) {


        }
    }
}
